type GeneratedTypeLiteralInterface = () => number;

export function foo(example: GeneratedTypeLiteralInterface): number {
  return example();
}

export interface Foo {
  (bar: string): this;
}

type Example = () => string;

function foo(example: () => number): number {
  return example();
}

interface ReturnsSelf {
  // returns the function itself, not the `this` argument.
  (arg: string): this;
}

//github
type Foo = () => string;
//output: type Foo = () => string;

export default interface Foo {
  /** comment */
  (): string;
}
//output: null

// comment
type Foo = () => string;
//output: type Foo = () => string;

/** comment */
export type Foo = () => string;
//output: export type Foo = () => string;

// comment
export type Foo = () => string;
//output: export type Foo = () => string;

function foo(bar: /* comment */ ((s: string) => number) | undefined): number {
  return bar('hello');
}
/*output:
function foo(bar: *//* comment *//* ((s: string) => number) | undefined): number {
  return bar('hello');
}*/

type Foo = () => string;
//output: type Foo = () => string;

function foo(bar: (s: string) => number): number {
  return bar('hello');
}
/*output:
function foo(bar: (s: string) => number): number {
  return bar('hello');
}
*/

function foo(bar: ((s: string) => number) | undefined): number {
  return bar('hello');
}
/*output:
function foo(bar: ((s: string) => number) | undefined): number {
  return bar('hello');
}
*/

type Foo = () => void;
//output: type Foo = () => void;

type Foo<T> = (bar: T) => string;
//output: type Foo<T> = (bar: T) => string;

type Foo<T> = (this: T) => void;
//output: type Foo<T> = (this: T) => void;

type Foo<T> = (this: string) => T;
//output: type Foo<T> = (this: string) => T;

interface Foo {
  (arg: this): void;
}

interface Foo {
  (arg: number): this | undefined;
}

type Foo = () => {
    a: {
      nested: this;
    };
    between: this;
    b: {
      nested: string;
    };
  };

/*output:
type Foo = () => {
  a: {
    nested: this;
  };
  between: this;
  b: {
    nested: string;
  };
};
*/

type X = {} | (() => void)
//output:type X = {} | (() => void)

type X = {} & (() => void);
//output: type X = {} & (() => void);